package org.thread.test05.demo02;

import java.util.concurrent.Callable;

/**
 * @author ZJL
 * @date 2025-03-11
 */
public class MainTest {
    public static void main(String[] args) {
//        五、编写程序，使用多线程，实现电影院售票的过程。
//        （使用两种方法实现）
//        1）多个线程各自卖自己的50张票 -- 继承 Thread

        /*TicketThread1 t1 = new TicketThread1();
        TicketThread1 t2 = new TicketThread1();
        TicketThread1 t3 = new TicketThread1();
        t1.setName("窗口一：");
        t2.setName("窗口二：");
        t3.setName("窗口三：");
        t1.start();
        t2.start();
        t3.start();*/

//        2）多个线程共同卖相同的50张票 -- 实现 Runnable Callable

        TicketThread2  tr  = new TicketThread2();
        Thread t1 = new Thread(tr);
        Thread t2 = new Thread(tr);
        Thread t3 = new Thread(tr);
        t1.setName("窗口一：");
        t2.setName("窗口二：");
        t3.setName("窗口三：");
        t1.start();
        t2.start();
        t3.start();

    }
}
